home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8337 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: casbah.acns.nwu.edu!muzaffar
  2. From: muzaffar@casbah.acns.nwu.edu (Usman Muzaffar)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to make this code portable?
  5. Date: 3 Mar 1996 10:29:30 GMT
  6. Organization: Northwestern University, Evanston IL
  7. Message-ID: <4hbsaa$fmu@news.acns.nwu.edu>
  8. References: <4h8k9j$78r@habs.ee.ubc.ca>
  9. NNTP-Posting-Host: casbah.acns.nwu.edu
  10.  
  11. In article <4h8k9j$78r@habs.ee.ubc.ca>, Ellen Ho <ellenh@ee.ubc.ca> wrote:
  12. >I am writing a program that I want to compile and run on both a Sun 
  13. >Sparcstation and a PC running OS/2 Warp.  On the Sun, I compile the .c 
  14. >files with gcc.  On the PC, I am using Visual Age.
  15. >
  16. >The program acceptes a list of filenames as command line
  17. >arguments and does some processing with the list of files.
  18. >On the Sun, I specify 
  19. >
  20. >        program *.txt
  21. >
  22. >and the shell will expand the wildcard into the names of all .txt
  23. >files in the current working directory.  So with a for loop in
  24. >my C program I can go through each file and process the data.
  25. >
  26. >However, on the PC, "*.txt" is passed into my program as
  27. >command line argument as is.  This means that I may have to
  28. >put in extra operating system dependent logic to expand the wildcard
  29. >inside my program.
  30. >
  31. >Are there other ways to handle this?
  32.  
  33. I think the best way to approach this is to write a dos batch file
  34. that reads all .txt files and feeds them to your code. Or, if that's
  35. not easy, just write a couple of lines of which do it and call that
  36. as a frontend. Your main code stays untouched.
  37.  
  38.